<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>NavMenu 导航菜单 | MyUI 4.x</title>
    <meta name="generator" content="VuePress 1.5.4">
    <link rel="icon" href="/my/favicon.ico">
    <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?c4e5f73318b5cb0c389e3d9a05f831cc";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
    <meta name="description" content="MyUI是美亚柏科旗下新德汇出品的Web前端一站式项目工程框架，专注于公检法行业中台系统快速搭建，框架已在多个项目实战检验。">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <link rel="preload" href="/my/assets/css/0.styles.810d4cba.css" as="style"><link rel="preload" href="/my/assets/js/app.2dbd0b81.js" as="script"><link rel="preload" href="/my/assets/js/493.009afff8.js" as="script"><link rel="preload" href="/my/assets/js/1320.97f611ca.js" as="script"><link rel="preload" href="/my/assets/js/1031.8d6cd2c9.js" as="script">
    <link rel="stylesheet" href="/my/assets/css/0.styles.810d4cba.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/my/" class="home-link router-link-active"><img src="/my/img/logo.png" alt="MyUI 4.x" class="logo"> <span class="site-name can-hide">MyUI 4.x</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/my/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/my/ui/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/my/ui/charts/" class="nav-link">
  图表
</a></div><div class="nav-item"><a href="/my/ui/map/" class="nav-link">
  地图
</a></div><div class="nav-item"><a href="/my/ui/go/" class="nav-link">
  关系图
</a></div><div class="nav-item"><a href="/my/ui/icon/" class="nav-link">
  图标
</a></div><div class="nav-item"><a href="/my/ui/pages/" class="nav-link">
  页面
</a></div><div class="nav-item"><a href="http://newgateway.gitee.io/my-web/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="JSDoc" class="dropdown-title"><span class="title">JSDoc</span> <span class="arrow down"></span></button> <button type="button" aria-label="JSDoc" class="mobile-dropdown-title"><span class="title">JSDoc</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/my/api/components.html" class="nav-link">
  基础组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/utils.html" class="nav-link">
  工具函数
</a></li><li class="dropdown-item"><!----> <a href="/my/api/charts.html" class="nav-link">
  图表组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/map.html" class="nav-link">
  地图组件
</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/my/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/my/ui/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/my/ui/charts/" class="nav-link">
  图表
</a></div><div class="nav-item"><a href="/my/ui/map/" class="nav-link">
  地图
</a></div><div class="nav-item"><a href="/my/ui/go/" class="nav-link">
  关系图
</a></div><div class="nav-item"><a href="/my/ui/icon/" class="nav-link">
  图标
</a></div><div class="nav-item"><a href="/my/ui/pages/" class="nav-link">
  页面
</a></div><div class="nav-item"><a href="http://newgateway.gitee.io/my-web/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="JSDoc" class="dropdown-title"><span class="title">JSDoc</span> <span class="arrow down"></span></button> <button type="button" aria-label="JSDoc" class="mobile-dropdown-title"><span class="title">JSDoc</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/my/api/components.html" class="nav-link">
  基础组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/utils.html" class="nav-link">
  工具函数
</a></li><li class="dropdown-item"><!----> <a href="/my/api/charts.html" class="nav-link">
  图表组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/map.html" class="nav-link">
  地图组件
</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Basic</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Form</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Data</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Notice</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Navigation</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/my/element/breadcrumb.html" class="sidebar-link">Breadcrumb 面包屑</a></li><li><a href="/my/element/dropdown.html" class="sidebar-link">Dropdown 下拉菜单</a></li><li><a href="/my/element/menu.html" aria-current="page" class="active sidebar-link">NavMenu 导航菜单</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/my/element/menu.html#顶栏" class="sidebar-link">顶栏</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#侧栏" class="sidebar-link">侧栏</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#折叠" class="sidebar-link">折叠</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#menu-attribute" class="sidebar-link">Menu Attribute</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#menu-methods" class="sidebar-link">Menu Methods</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#menu-events" class="sidebar-link">Menu Events</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#submenu-attribute" class="sidebar-link">SubMenu Attribute</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#menu-item-attribute" class="sidebar-link">Menu-Item Attribute</a></li><li class="sidebar-sub-header"><a href="/my/element/menu.html#menu-group-attribute" class="sidebar-link">Menu-Group Attribute</a></li></ul></li><li><a href="/my/element/page-header.html" class="sidebar-link">PageHeader 页头</a></li><li><a href="/my/element/steps.html" class="sidebar-link">Steps 步骤条</a></li><li><a href="/my/element/tabs.html" class="sidebar-link">Tabs 标签页</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Others</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="navmenu-导航菜单"><a href="#navmenu-导航菜单" class="header-anchor">#</a> NavMenu 导航菜单</h1> <p>为网站提供导航功能的菜单。</p> <h2 id="顶栏"><a href="#顶栏" class="header-anchor">#</a> 顶栏</h2> <p>适用广泛的基础用法。</p> <!----><h2 id="侧栏"><a href="#侧栏" class="header-anchor">#</a> 侧栏</h2> <p>垂直菜单，可内嵌子菜单。</p> <!----><h2 id="折叠"><a href="#折叠" class="header-anchor">#</a> 折叠</h2> <!----><h2 id="menu-attribute"><a href="#menu-attribute" class="header-anchor">#</a> Menu Attribute</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>mode</td> <td>模式</td> <td>string</td> <td>horizontal / vertical</td> <td>vertical</td></tr> <tr><td>collapse</td> <td>是否水平折叠收起菜单（仅在 mode 为 vertical 时可用）</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>background-color</td> <td>菜单的背景色（仅支持 hex 格式）</td> <td>string</td> <td>—</td> <td>#ffffff</td></tr> <tr><td>text-color</td> <td>菜单的文字颜色（仅支持 hex 格式）</td> <td>string</td> <td>—</td> <td>#303133</td></tr> <tr><td>active-text-color</td> <td>当前激活菜单的文字颜色（仅支持 hex 格式）</td> <td>string</td> <td>—</td> <td>#409EFF</td></tr> <tr><td>default-active</td> <td>当前激活菜单的 index</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>default-openeds</td> <td>当前打开的 sub-menu 的 index 的数组</td> <td>Array</td> <td>—</td> <td>—</td></tr> <tr><td>unique-opened</td> <td>是否只保持一个子菜单的展开</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>menu-trigger</td> <td>子菜单打开的触发方式(只在 mode 为 horizontal 时有效)</td> <td>string</td> <td>hover / click</td> <td>hover</td></tr> <tr><td>router</td> <td>是否使用 vue-router 的模式，启用该模式会在激活导航时以 index 作为 path 进行路由跳转</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>collapse-transition</td> <td>是否开启折叠动画</td> <td>boolean</td> <td>—</td> <td>true</td></tr></tbody></table> <h2 id="menu-methods"><a href="#menu-methods" class="header-anchor">#</a> Menu Methods</h2> <table><thead><tr><th>方法名称</th> <th>说明</th> <th>参数</th></tr></thead> <tbody><tr><td>open</td> <td>展开指定的 sub-menu</td> <td>index: 需要打开的 sub-menu 的 index</td></tr> <tr><td>close</td> <td>收起指定的 sub-menu</td> <td>index: 需要收起的 sub-menu 的 index</td></tr></tbody></table> <h2 id="menu-events"><a href="#menu-events" class="header-anchor">#</a> Menu Events</h2> <table><thead><tr><th>事件名称</th> <th>说明</th> <th>回调参数</th></tr></thead> <tbody><tr><td>select</td> <td>菜单激活回调</td> <td>index: 选中菜单项的 index, indexPath: 选中菜单项的 index path</td></tr> <tr><td>open</td> <td>sub-menu 展开的回调</td> <td>index: 打开的 sub-menu 的 index， indexPath: 打开的 sub-menu 的 index path</td></tr> <tr><td>close</td> <td>sub-menu 收起的回调</td> <td>index: 收起的 sub-menu 的 index， indexPath: 收起的 sub-menu 的 index path</td></tr></tbody></table> <h2 id="submenu-attribute"><a href="#submenu-attribute" class="header-anchor">#</a> SubMenu Attribute</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>index</td> <td>唯一标志</td> <td>string/null</td> <td>—</td> <td>null</td></tr> <tr><td>popper-class</td> <td>弹出菜单的自定义类名</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>show-timeout</td> <td>展开 sub-menu 的延时</td> <td>number</td> <td>—</td> <td>300</td></tr> <tr><td>hide-timeout</td> <td>收起 sub-menu 的延时</td> <td>number</td> <td>—</td> <td>300</td></tr> <tr><td>disabled</td> <td>是否禁用</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>popper-append-to-body</td> <td>是否将弹出菜单插入至 body 元素。在菜单的定位出现问题时，可尝试修改该属性</td> <td>boolean</td> <td>—</td> <td>一级子菜单：true / 非一级子菜单：false</td></tr></tbody></table> <h2 id="menu-item-attribute"><a href="#menu-item-attribute" class="header-anchor">#</a> Menu-Item Attribute</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>index</td> <td>唯一标志</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>route</td> <td>Vue Router 路径对象</td> <td>Object</td> <td>—</td> <td>—</td></tr> <tr><td>disabled</td> <td>是否禁用</td> <td>boolean</td> <td>—</td> <td>false</td></tr></tbody></table> <h2 id="menu-group-attribute"><a href="#menu-group-attribute" class="header-anchor">#</a> Menu-Group Attribute</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>title</td> <td>分组标题</td> <td>string</td> <td>—</td> <td>—</td></tr></tbody></table></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/my/element/dropdown.html" class="prev">
        Dropdown 下拉菜单
      </a></span> <span class="next"><a href="/my/element/page-header.html">
        PageHeader 页头
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/my/assets/js/app.2dbd0b81.js" defer></script><script src="/my/assets/js/493.009afff8.js" defer></script><script src="/my/assets/js/1320.97f611ca.js" defer></script><script src="/my/assets/js/1031.8d6cd2c9.js" defer></script>
  </body>
</html>
